package com.library.controller.user;

import com.library.pojo.PageResult;
import com.library.pojo.Result;
import com.library.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController("userBook")
@RequestMapping("/user/book")
public class BookController {
    @Autowired
    private BookService bookService;
    /**
     * 分页查询书籍
     */
    @GetMapping("/page")
    public Result pageQuery(@RequestParam(defaultValue = "1")Integer page
            , @RequestParam(defaultValue = "10")Integer pageSize, String bookName,
                            String author, String publisher,String category){
        PageResult result =
                bookService.pageQuery(page,pageSize,bookName,author,publisher,category);
        return Result.success(result);
    }
}
